/**
 * 
 */
package com.gpms.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

/**
 * @author laborc
 *
 */
public class SuggestDao implements ISuggestDao {

	public String add(Object obj) {
		String result;
		Session session = HibernateSessionFactory.getSession();
		Transaction tx = null;
		try{
			tx = session.beginTransaction();
			session.save(obj);
			tx.commit();
		}catch(Exception e)
		{
			result = "input";
			e.printStackTrace();
			tx.rollback();
		}finally{
			HibernateSessionFactory.closeSession();
		}
		result = "success";
		return result;
	}

	public void delete(Object obj) {
		// TODO Auto-generated method stub

	}

	public String modify(Object obj) {
		// TODO Auto-generated method stub
		return null;
	}

	public String save(List<?> objs) {
		return null;
	}

	public List<Object> selectByHql(String hql) {
		List<Object> suggest=null;
		try{
			suggest=(List<Object>)HibernateSessionFactory.getSession().createQuery(hql).list();
		}catch (Exception e)
		{
			e.printStackTrace();
		}
		return suggest;
	}

	public Object selectById(String cls, Serializable key) {
		// TODO Auto-generated method stub
		return null;
	}

	public Object selectById(Object object) {
		// TODO Auto-generated method stub
		return null;
	}

}
